package com.atguigu.chaptar2

object $03_Recursion {
  def main(args: Array[String]): Unit = {
    println(m1(5))
    println(func(5))
  }
  def m1(n:Int):Int={
    if(n==1){
      1
    }else{
      n*m1(n-1)
    }
  }
  val func:Int=>Int=(x:Int)=>{
    if(x==1)1
    else{
      x*func(x-1)
    }
  }

}
